package com.bw.zg3park2212.emp

import androidx.lifecycle.MutableLiveData
import com.bw.base.entity.*
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class EmpViewModoel @Inject constructor(val apiService: ApiService):BaseViewModel() {
    val empSuccse=MutableLiveData<EmpEntity>()
    fun emp(){
        httpRequst(
            {apiService.getemp()},
            empSuccse::postValue
        )
    }
    val departSuccse=MutableLiveData<DepartEntity>()
    fun depart(){
        httpRequst(
            {apiService.getdep()},
            departSuccse::postValue)
    }
    val deparknumSuccse=MutableLiveData<EmpEntity>()
    fun deparknum(departmentId:Int){
        httpRequst(
            {apiService.getdepnum(departmentId)},
            deparknumSuccse::postValue)
    }
    val empaddSuccse=MutableLiveData<EmpEntityItem>()
    fun empadd(empAddParam: EmpAddParam){
        httpRequst(
            {apiService.getemadd(empAddParam)},
            empaddSuccse::postValue)
    }
}